<template>
  <div>
    <div class="login-head">
      <span style="color: #fff" @click="jumpFn()">
        <van-icon name="arrow-left"
      /></span>
      <span class="login-title">账户信息</span>
      <span></span>
    </div>
    <div class="search-head">
      <el-input
        placeholder="请输入内容"
        v-model="input"
        clearable
        style="width: 72%"
      >
      </el-input>
      <van-button
        type="info"
        style="height: 40px; border-radius: 5px; padding: 0 20px"
        @click="jumpTj(input)"
        >确认</van-button
      >
    </div>
    <ul>
      <li :key="i" v-for="(v, i) in datas" class="list">
        <p>{{ v.name }}</p>
        <p>{{ v.address }}</p>
      </li>
    </ul>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  name: "searchAdress",

  data() {
    return {
      input: "",
      datas: {},
    };
  },
  mounted() {},
  methods: {
    jumpFn() {
      this.$router.back();
    },
    jumpTj(input) {
      this.$store.commit("changePlace", input);
    },
  },
  created() {
    this.axios({
      metod: "GET",
      url: `https://elm.cangdu.org/v1/pois?city_id=${this.$store.state.allPlace.id}&keyword=${this.$store.state.input}&type=search`,
    }).then((response) => {
      console.log(response)
      this.datas = response.data;
      console.log(this.datas);
      // console.log(this.$store.state.searchCityVal);
    });
  },
  computed: {
    ...mapState(["homeAdress"]),
  },
};
</script>

<style scoped>
.login-head {
  width: 100%;
  height: 1.2576rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0092e8;
  position: fixed;
  top: 0;
  left: 0;
}
.login-title {
  color: white;
  position: relative;
  left: -0.5405rem;
  font-size: 0.5405rem;
}
.search-head {
  margin-top: 55px;
  width: 100%;
  height: 65px;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.search-head inputP {
  width: 70%;
}
</style>